﻿using System.Linq;
using ReagentStore.ERM;
using ReagentStore.UTL;

namespace ReagentStore.BLL
{
	public static class ReagentExtension
	{
		public static int Quantity(this Reagent reagent)
		{
			return new ReagentBLL().GetQuantity(reagent);
		}

		public static ColorPairs GetColorPairs(this Reagent reagent)
		{
			var bll = new ReagentBLL();
			bool alert = bll.GetAlertList().Select(r => r.ReagentID).Contains(reagent.ReagentID);
			bool purchase = bll.GetPurchaseList().Select(r => r.ReagentID).Contains(reagent.ReagentID);

			if (alert)
				return ReagentColorParis.Important;

			if (purchase)
				return ReagentColorParis.Attentional;

			return ReagentColorParis.Normal;
		}
	}
}